package java06;

import java.util.Scanner;

public class 评委打分 {
    public static void main(String[] args) {
        int[] arr = new int[6];
        Scanner sc = new Scanner(System.in);
        for (int i = 0; i < arr.length; i++) {
            System.out.println("请输入第"+(i+1)+"位评委的打分");
            int temp = sc.nextInt();


            if(temp > 100 || temp < 0){
                System.out.println("输入有误");
                i--;
            }else{
                arr[i] = temp;
            }


        }
        double score=getAverage(arr);
        System.out.println(score);
    }

    public static double getAverage(int[] arr) {
        double sum=0;
        for (int i = 0; i < arr.length; i++) {
            sum+=arr[i];
        }
        int max=arr[0];
        for (int i = 0; i < arr.length; i++) {
            max=Math.max(max,arr[i]);
        }
        int min=arr[0];
        for(int i=1;i<arr.length;i++){
            min=Math.min(min,arr[i]);
        }
        sum=sum-max-min;
        return sum/(arr.length-2);
    }
}
